package se.webbzon.oschi01.worldobject.appearance;

import java.awt.Color;

import javax.media.j3d.BoundingSphere;
import javax.media.j3d.DirectionalLight;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3f;

public class DirectionalLightAppearance3D extends LightAppearance3D {
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new directional light appearance. **/
	public DirectionalLightAppearance3D(Vector3f direction, Color color) {
		super(new DirectionalLight(true,new Color3f(color),direction));
		setInfluencingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0), 1000.0));
		DirectionalLight light = (DirectionalLight) getLight();
		light.setCapability(DirectionalLight.ALLOW_DIRECTION_READ);
		light.setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE);
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Copies the direction of the light to the given Vector3f. **/
	public void getDirection(Vector3f direction) {
		((DirectionalLight) getLight()).getDirection(direction);
	}
	
	/** Sets the direction of the light. **/
	public void setDirection(Vector3f direction) {
		((DirectionalLight) getLight()).setDirection(direction);
	}

}
